// function play<T,K>(array:T[],key:K){

// }

/**
 * 代码在编译的时候，无法明确T是什么
 * @param msg 
 */
interface ILen {
    length:number,
    size:number
}
function getSize<T extends ILen>(msg:T){
    console.log(msg.length);
    console.log(msg.size);
    
}

// getSize<string>("xiaowang")

interface IPeople {
    name:string,
    age:number
}

const people = {
    name:"xiaowang",
    age:23
}
//typeof可以根据你的数据结果，得到对应类型
type newPeo = typeof people  //newPeo = {name:string,age:number}

const users =  [
    {id:1,name:"xiaowang",classes:{id:1}}
]
type newUsers = typeof users // users完整约束

const user1:newUsers = [
    {id:2,name:"xiaofei",classes:{id:2}}
]



export {}



